package algorithm.poj.p1000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;

public class P1564 {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P1564.class.getResource("P1564.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		ListComparator listComp = new ListComparator();
		IntegerComparator intComp = new IntegerComparator();
		StringTokenizer st = null;
		String line = stdin.readLine();
		while (line != null && !"0 0".equals(line)) {
			st = new StringTokenizer(line);
			int t = Integer.valueOf(st.nextToken());
			int n = Integer.valueOf(st.nextToken());
			List<Integer> ds = new ArrayList<Integer>();
			List<Integer> cs = new ArrayList<Integer>();
			for (int i = 0; i < n; i ++) {
				Integer d = Integer.valueOf(st.nextToken());
				if (ds.size() == 0) {
					ds.add(d);
					cs.add(1);
				} else {
					int last = ds.size()-1;
					if (ds.get(last).intValue() == d.intValue()) {
						cs.set(last, cs.get(last)+1);
					} else {
						ds.add(d);
						cs.add(1);
					}
				}
			}
			List<List<Integer>> lists = sums(t, ds.toArray(new Integer[ds.size()]), cs.toArray(new Integer[cs.size()]));
			System.out.println("Sums of " + t + ":");
			if (lists.size() > 0) {
				for (List<Integer> list: lists) {
					Collections.reverse(list);
				}
				Collections.sort(lists, listComp);
				for (List<Integer> list: lists) {
					Collections.sort(list, intComp);
					StringBuffer sb = new StringBuffer("");
					for (int i = 0; i < list.size()-1; i ++) {
						sb.append(list.get(i)).append("+");
					}
					sb.append(list.get(list.size()-1));
					System.out.println(sb);
				}
			} else {
				System.out.println("NONE");
			}
			line = stdin.readLine();
		}
	}
	
	private static class ListComparator implements Comparator<List<Integer>> {

		public int compare(List<Integer> list1, List<Integer> list2) {
			int size = Math.min(list1.size(), list2.size());
			for (int i = 0; i < size-1; i ++) {
				if (list1.get(i) < list2.get(i)) {
					return +1;
				} else if (list1.get(i) > list2.get(i)) {
					return -1;
				}
			}
			return 0;
		}
	}
	
	private static class IntegerComparator implements Comparator<Integer> {

		public int compare(Integer n1, Integer n2) {
			return -n1.compareTo(n2);
		}
		
	}

	private static List<List<Integer>> sums(int t, Integer[] ds, Integer[] cs) {
		
		if (t == 0) {
			List<List<Integer>> r = new ArrayList<List<Integer>>();
			List<Integer> list = new ArrayList<Integer>();
			r.add(list);
			return r;
		} else {
			int s = 0;
			for (int i = 0; i < ds.length; i ++) {
				s += ds[i]*cs[i];
			}
			if (t > s) {
				return new ArrayList<List<Integer>>();
			} else if (t == s) {
				List<Integer> list = new ArrayList<Integer>();
				for (int i = 0; i < cs.length; i ++) {
					for (int j = 0; j < cs[i]; j ++) {
						list.add(ds[i]);
					}
				}
				List<List<Integer>> r = new ArrayList<List<Integer>>();
				r.add(list);
				return r;
			} else {
				List<List<Integer>> r = new ArrayList<List<Integer>>();
				for (int i = 0; i < cs.length; i ++) {
					if (cs[i] > 0) {
						Integer[] nds = new Integer[ds.length-i];
						Integer[] ncs = new Integer[ds.length-i];
						nds[0] = ds[i];
						ncs[0] = cs[i]-1;
						for (int j = 1; j < ncs.length; j ++) {
							nds[j] = ds[j+i];
							ncs[j] = cs[j+i];
						}
						List<List<Integer>> lists = sums(t-ds[i], nds, ncs);
						for (List<Integer> list: lists) {
							list.add(ds[i]);
							r.add(list);
						}
					}
				}
				return r;
			}
		}
	}
}